﻿@model IEnumerable<Developer.Entity.CycleProblem>

@{
    ViewBag.Title = "SelectModel";
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" href="~/Content/UI/css/mdui.min.css" />
    <link rel="stylesheet" href="~/Content/UI/css/getprice.min.css" />
    <link href="~/Content/UI/css/mdui.min.css" rel="stylesheet" />
    <link href="~/Content/UI/css/jquery-labelauty.css" rel="stylesheet" />
    <style type="text/css">
        ul {
            list-style-type: none;
        }

        li {
            display: inline-block;
        }

        li {
            margin: 10px 0;
        }

        input.labelauty + label {
            font: 12px "Microsoft Yahei";
        }
    </style>
</head>

<body>

    <form action="/recycle/getprice?mid=@Model.FirstOrDefault().CycleModelId" method="post">
        <div style="margin-top:15px;margin-bottom:50px">
            @{
                var i = 1;
                var j = 1;
                foreach (var item in Model.OrderBy(a => a.Sequence))
                {
                    if (item.Name.Contains("（") || item.Name.Contains("("))
                    {
                        <p>@item.Name</p>
                        <ul class="dowebok">
                            @foreach (var detail in item.CycleProblemDetail.OrderBy(a => a.Sequence))
                            {
                                <li><input type="checkbox" name="checkbox@(j++)" data-labelauty="@detail.Name" value="@detail.Price" title="@detail.Name" /></li>

                            }

                        </ul>
                    }
                    else
                    {
                        <p>@item.Name</p>
                        <ul class="dowebok">
                            @foreach (var detail in item.CycleProblemDetail.OrderBy(a => a.Sequence))
                            {
                                <li><input type="radio" name="radio@(i)" data-labelauty="@detail.Name" value="@(detail.Price)" title="@detail.Name" /></li>

                            }
                        </ul>
                        i++;
                    }
                }
            }
        </div>
            <input id="radioval" value="" type="hidden" name="totalProblem" />
            <div class="mdui-col-md-12" style="width:100%">
                <div class="sure-order">
                    <button type="submit" class="sure-order-button" onclick="getradio()">提交</button>
                </div>
            </div>
       
    </form>

    

    <script src="~/Content/UI/js/jquery-1.8.3.min.js"></script>
    <script src="~/Content/UI/js/jquery-labelauty.js"></script>
    <script src="~/Content/UI/js/mdui.min.js"></script>
    <script src="~/Content/UI/js/mui.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(':input').labelauty();
        });
        function getradio() {
            var detail = $('#radioval').val();
            $('input:radio:checked').each(function (i, val) {
                detail += val.title + ",";
            });
            $('input:checkbox:checked').each(function (i, val) {
                detail += val.title + ",";
            });
            $('#radioval').val(detail);
        }
        function batdel(url) {
            var checkedArr = new Array();
            $("input:checkbox[name=checkbox]:checked")
                .each(function () {
                    checkedArr.push($(this).val());
                });
            if (checkedArr.length < 1) {
                layer.msg("请选择要删除的项", { time: 2000 });
            } else {
                layer.confirm("确认要删除吗？", function () {
                    $.ajax({
                        type: "POST",
                        url: url,
                        data: { 'ids': checkedArr },
                        success: function () {
                            location.replace(location.href);
                        },
                        error: function (msg) {
                            layer.msg(msg, { time: 1000 });
                        }
                    });
                });
            }

        }
    </script>
</body>
</html>